home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7601 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Best way to insert in file
  5. Date: 25 Feb 1996 16:44:41 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4gqvppINNh86@keats.ugrad.cs.ubc.ca>
  8. References: <4gldjl$cck@news.fwi.com> <1996Feb25.164738.7783@zcon.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <1996Feb25.164738.7783@zcon.com>,
  12. Syed Zaeem Hosain <szh@zcon.com> wrote:
  13.  >In article <4gldjl$cck@news.fwi.com>, stork@serv2.fwi.com (Bryan Liles) writes:
  14.  >>What would be the best way to insert data in to the middle of a text file?
  15.  >>I have a program that is supposed to automatically fill out an application.
  16.  >>(its a an internic domain app)  
  17.  >
  18.  >Please look at the FAQ and read question 19.14 and its answer. It
  19.  >addresses your question exactly. For reference, here is the question
  20.  >(with answer deleted, to make you go look and hopefully remember to
  21.  >read the FAQ before posting next time <smile>):
  22.  >
  23.  >19.14:  How can I insert or delete a line (or record) in the middle of a
  24.  >        file?
  25.  >
  26.  >If you do not have the comp.lang.c FAQ, it can be found at rtfm.mit.edu
  27.  >in an appropriate subdirectory of /pub/usenet/.
  28.  
  29. Of course, the real answer is to avoid writing a C program, and use a filter
  30. utility called "sed". I have used this little program to edit the 200,000+th
  31. line of a 400,000 line text file. Writing C code to do the same thing is
  32. redundant, considering that sed can do all kinds of things to a file other than
  33. just insert and delete lines.
  34.  
  35. Those who don't know UNIX are bound to repeat it... badly.
  36. -- 
  37.  
  38.